<?
session_start();
if (!isset($_SESSION[login])) {
     header("Location: HomeIndex.php");
     exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Manage Project Admin</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<SCRIPT LANGUAGE="JavaScript">

function chkData(text){ 
tmp =document.all.item("text").value;
if (tmp != "")
searchpro.submit();
else {
alert("Enter Name");
document.all.item("text").focus();
searchpro.submit(); 
}
}
</SCRIPT>
<meta charset="utf-8">
<meta name="description" content="Place your description here">
<meta name="keywords" content="put, your, keyword, here">
<meta name="author" content="Templates.com - website templates provider">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 7]>
     <link rel="stylesheet" href="css/ie/ie6.css" type="text/css" media="screen">
     <script type="text/javascript" src="js/ie_png.js"></script>
     <script type="text/javascript">
        ie_png.fix('.png, footer, header nav ul li a, .nav-bg, .list li img');
     </script>
<![endif]-->
<!--[if lt IE 9]>
  	<script type="text/javascript" src="js/html5.js"></script>
  <![endif]-->
  <script type="text/javascript">
  <!--
	function chkData(){
		searchpro.submit();
  }
  //-->
  </script>
</head>
<body id="page1">
<div class="wrap"> 
  <!-- header -->
  <header>
    <div class="container">
      <h1><a href="homeAdmin.php">Student Portfolio Management System</a></h1>
      <nav>
        <ul>
          <li><a href="homeAdmin.php" class="m1">หน้าแรก</a></li>
          <li><a href="searchAdmin.php" class="m1">ค้นหา</a></li>
          <li><a href="uploadAdmin.php" class="m1">อัพโหลด</a></li>
          <li class="current"><a href="manageAdmin.php" class="m3">จัดการข้อมูลเบื้องต้น</a></li>
          <li class="last"><a href="reportAdmin.php" class="m3">ออกรายงาน</a></li>
        </ul>
      </nav>
      <form action="" id="search-form">
        <fieldset>
          <div class="rowElem">
            <input type="text">
            <a href="#" onClick="document.getElementById('search-form').submit()">ค้นหา</a></div>
        </fieldset>
      </form>
    </div>
  </header>
  <div class="container"> 
    <!-- aside -->
    <aside>
      <div class="wrap"> 
        <!-- header -->
        <div class="container"> 
          <!-- aside -->
          <aside>
            <h2 align ="left">ยินดีต้อนรับ</h2>
			 <p><? echo $_SESSION["ses_name"]; ?></p>
            <input name="editSelf" type="button" value="แก้ไขข้อมูลส่วนตัว" onClick="window.location='editselfAdmin.php'"><br><br>
            <input name="logOut" type="button" value="ออกจากระบบ" onClick="window.location='logout.php'">
          </aside>
          <!-- content -->
          <section id="content">
            <div class="inside"> </div>
          </section>
        </div>
      </div>
    </aside>
    <!-- content -->
    <section id="content">
    <div class="inside">
    <p class="style30">ระบบจัดการผลงานนักศึกษา</p>
    <hr />
    <table height="58" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="39" colspan="4">
      </tr>
      <tr>
          <td width="143" height="19" valign="middle">
        <form name="searchpro" method="post" action="ManageProject.php">
          <div align="right">
            <select name="selectpro">
              <option selected="selected">ชื่อผลงาน</option>
              <option>รหัสนักศึกษา</option>
              <option>ชื่อเจ้าของผลงาน</option>
            </select>
          </div>
            </td>
          <td width="65" valign="middle"><div align="center">ค้นหา</div></td>
          <td width="200" valign="middle"><div align="center">
              <input type="text" size="50" name="text"/>
            </div></td>
          <td width="75" valign="middle"><div align="center">
            <div align="center">
              <input type="button" name="btn" onclick="chkData()" value="ค้นหา" />
            </div>
        </form>
        </div>
      
        </td>
      
        </tr>
      
    </table>
  </div>
  <p>&nbsp;</p>
  <table width="600" height="94" border="1" cellpadding="5" cellspacing="0" bordercolor="#999999">
    <tr>
      <td width="250" height="30" bgcolor="#C2CFDF" valign="middle"><div align="center" class="style29"><b>ชื่อผลงาน</b></div></td>
      <td width="100" bgcolor="#C2CFDF" valign="middle"><div align="center" class="style29"><b>ประเภทผลงาน</b></div></td>
      <td width="75" bgcolor="#C2CFDF" valign="middle"><div align="center" class="style29"><b>สถานะ</b></div></td>
      <td width="75" bgcolor="#C2CFDF" valign="middle"><div align="center" class="style29"><b>แก้ไขข้อมูล</b></div></td>
      <td width="60" bgcolor="#C2CFDF" valign="middle"><div align="center" class="style29">
          <div align="center"><b>ลบข้อมูล</b></div>
        </div></td>
    </tr>
    <? require("connectDB.php");    //include "connectdb.inc";
if ($selectpro == "ชื่อผลงาน")
$tmp="select * from project where project_name like '$text%' order by project_id;";
else if ($selectpro == "รหัสนักศึกษา")
$tmp="select * from project where student_id like '$text%' order by project_id;";
elseif ($selectpro == "ชื่อเจ้าของผลงาน")
$tmp="select * from project where owner_name like '$text%' order by project_id;";
else
$tmp="select * from project order by project_id;";

//echo($tmp);
$sql = mysql_query($tmp);
while($result = mysql_fetch_array($sql))    { ?>
    <TR>
      <TD valign="middle"><? echo $result["project_name"]; ?></TD>
      <td align="center" valign="middle"><? echo $result["project_type"]; ?></td>
      <td valign="middle"><? echo $result["project_status"];?></td>
      <TD valign="middle" align="center"> <a href="edituploadAdmin.php?id=<? echo $result["project_id"]; ?>" >แก้ไข</TD>
<TD valign="middle" align="center"> <a href="deleteproject.php?id=<? echo $result["project_id"]; ?>" >ลบ</TD>
</tr>
    <? }
mysql_free_result($sql);
mysql_close($con); ?>
  </table>
</div>
</body>
</html>
